package tiled.mapeditor.widget;

import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JMenuItem;

public class TMenuItem extends JMenuItem
{
    private boolean showIcon;

    public TMenuItem(boolean showIcon)
    {
        this.showIcon = showIcon;
    }

    public TMenuItem(Action action)
    {
        this(action, false);
    }

    public TMenuItem(Action action, boolean showIcon)
    {
        this(showIcon);
        setAction(action);
    }

    public void setShowIcon(boolean showIcon)
    {
        this.showIcon = showIcon;
    }

    public void setIcon(Icon icon)
    {
        if (showIcon)
        {
            super.setIcon(icon);
        }
    }
}
